﻿using lauimini_webform.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lauimini_webform
{
    public partial class plan : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            UserTargetService userTargetService = new UserTargetService();
            UserService userService = new UserService();
            if (Session["userAccount"] == null)
            {
                Response.Redirect("~/login.aspx");
            }
            string userAccount = Session["userAccount"].ToString();

            int userid = userService.getUserid(userAccount);
            morning(userid);
            shang(userid);
            after(userid);
            even(userid);

        }
        void morning(int userid)
        {
            UserTargetService userTargetService = new UserTargetService();
            MondayMorning.DataSource = userTargetService.getPlanList(userid, "Monday", 7, 9);
            MondayMorning.DataBind();
            TuesdayMorning.DataSource = userTargetService.getPlanList(userid, "Tuesday", 7, 9);
            TuesdayMorning.DataBind();
            WednesdayMorning.DataSource = userTargetService.getPlanList(userid, "Wednesday", 7, 9);
            WednesdayMorning.DataBind();
            ThursdayMorning.DataSource = userTargetService.getPlanList(userid, "Thursday", 7, 9);
            ThursdayMorning.DataBind();
            FridayMorning.DataSource = userTargetService.getPlanList(userid, "Friday", 7, 9);
            FridayMorning.DataBind();
            SaturdayMorning.DataSource = userTargetService.getPlanList(userid, "Saturday", 7, 9);
            SaturdayMorning.DataBind();
            SundayMorning.DataSource = userTargetService.getPlanList(userid, "Sunday", 7, 9);
            SundayMorning.DataBind();
        }
        void shang(int userid)
        {
            UserTargetService userTargetService = new UserTargetService();
            MondayShang.DataSource = userTargetService.getPlanList(userid, "Monday", 10, 12);
            MondayShang.DataBind();
            TuesdayShang.DataSource = userTargetService.getPlanList(userid, "Tuesday", 10, 12);
            TuesdayShang.DataBind();
            WednesdayShang.DataSource = userTargetService.getPlanList(userid, "Wednesday", 10, 12);
            WednesdayShang.DataBind();
            ThursdayShang.DataSource = userTargetService.getPlanList(userid, "Thursday", 10, 12);
            ThursdayShang.DataBind();
            FridayShang.DataSource = userTargetService.getPlanList(userid, "Friday", 10, 12);
            FridayShang.DataBind();
            SaturdayShang.DataSource = userTargetService.getPlanList(userid, "Saturday", 10, 12);
            SaturdayShang.DataBind();
            SundayShang.DataSource = userTargetService.getPlanList(userid, "Sunday", 10, 12);
            SundayShang.DataBind();
        }
        void after(int userid)
        {
            UserTargetService userTargetService = new UserTargetService();
            MondayAfter.DataSource = userTargetService.getPlanList(userid, "Monday", 13, 18);
            MondayAfter.DataBind();
            TuesdayAfter.DataSource = userTargetService.getPlanList(userid, "Tuesday", 13, 18);
            TuesdayAfter.DataBind();
            WednesdayAfter.DataSource = userTargetService.getPlanList(userid, "Wednesday", 13, 18);
            WednesdayAfter.DataBind();
            ThursdayAfter.DataSource = userTargetService.getPlanList(userid, "Thursday", 13, 18);
            ThursdayAfter.DataBind();
            FridayAfter.DataSource = userTargetService.getPlanList(userid, "Friday", 13, 18);
            FridayAfter.DataBind();
            SaturdayAfter.DataSource = userTargetService.getPlanList(userid, "Saturday", 13, 18);
            SaturdayAfter.DataBind();
            SundayAfter.DataSource = userTargetService.getPlanList(userid, "Sunday", 13, 18);
            SundayAfter.DataBind();
        }
        void even(int userid)
        {
            UserTargetService userTargetService = new UserTargetService();
            MondayEven.DataSource = userTargetService.getPlanList(userid, "Monday", 19, 23);
            MondayEven.DataBind();
            TuesdayEven.DataSource = userTargetService.getPlanList(userid, "Tuesday", 19, 23);
            TuesdayEven.DataBind();
            WednesdayEven.DataSource = userTargetService.getPlanList(userid, "Wednesday", 19, 23);
            WednesdayEven.DataBind();
            ThursdayEven.DataSource = userTargetService.getPlanList(userid, "Thursday", 19, 23);
            ThursdayEven.DataBind();
            FridayEven.DataSource = userTargetService.getPlanList(userid, "Friday", 19, 23);
            FridayEven.DataBind();
            SaturdayEven.DataSource = userTargetService.getPlanList(userid, "Saturday", 19, 23);
            SaturdayEven.DataBind();
            SundayEven.DataSource = userTargetService.getPlanList(userid, "Sunday", 19, 23);
            SundayEven.DataBind();
        }
    }
}
